﻿using SuperFrame.Charts.Modes;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace SuperFrame.Charts
{
    /// <summary>
    /// TemperatureHumidityControl.xaml 的交互逻辑
    /// </summary>
    public partial class ThControl : UserControl
    {
        public ThControl()
        {
            InitializeComponent();
            this.DataContext = this;
            this.Loaded += TemperatureHumidityControl_Loaded;
        }

        void TemperatureHumidityControl_Loaded(object sender, RoutedEventArgs e)
        {
            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(3);
            timer.Tick += timer_Tick;
            timer.Start();
        }

        void timer_Tick(object sender, EventArgs e)
        {
            Random random = new Random();
            double hValue = random.Next(0, 100);
            HumidityControl.CurrentValue = hValue;
            Random random2 = new Random();
            double tValue = random.Next(-30, 50);
            TemperatureControl.CurrentValue = tValue;
        }
        public List<IntervalMode> TemperatureIntervalList
        {
            get { return (List<IntervalMode>)GetValue(TemperatureIntervalListProperty); }
            set { SetValue(TemperatureIntervalListProperty, value); }
        }

        // Using a DependencyProperty as the backing store for TemperatureIntervalList.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TemperatureIntervalListProperty =
            DependencyProperty.Register("TemperatureIntervalList", typeof(List<IntervalMode>), typeof(ThControl), new PropertyMetadata(null));



        public List<IntervalMode> HumidityIntervalList
        {
            get { return (List<IntervalMode>)GetValue(HumidityIntervalListProperty); }
            set { SetValue(HumidityIntervalListProperty, value); }
        }

        // Using a DependencyProperty as the backing store for HumidityIntervalList.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty HumidityIntervalListProperty =
            DependencyProperty.Register("HumidityIntervalList", typeof(List<IntervalMode>), typeof(ThControl), new PropertyMetadata(null));




        public Brush OuterArcColors
        {
            get { return (Brush)GetValue(OuterArcColorsProperty); }
            set { SetValue(OuterArcColorsProperty, value); }
        }

        // Using a DependencyProperty as the backing store for OuterArcColors.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty OuterArcColorsProperty =
            DependencyProperty.Register("OuterArcColors", typeof(Brush), typeof(ThControl), new PropertyMetadata(new SolidColorBrush(Colors.White)));
    }
}
